package com.jandar.table.config;

/**
 * ID类。
 * 
 * @author pqj
 * @version 2009-5-31
 */
public class Id extends Column {

	/** 主键生成测率 */
	private IdGeneratorInfo generator = null;

	/** 序列字符串 */
	private String sequence = null;

	public IdGeneratorInfo getGenerator() {
		return generator;
	}

	public void setGenerator(IdGeneratorInfo generator) {
		this.generator = generator;
	}

	public String getSequence() {
		return sequence;
	}

	public void setSequence(String sequence) {
		this.sequence = sequence;
	}

	public String toString() {
		StringBuilder buf = new StringBuilder();
		buf.append("<id value=\"").append(value).append("\"").append(" type=\"").append(type)
				.append("\"");
		if (generator != null) {
			buf.append(" generator=\"").append(generator).append("\"");
		}
		if (sequence != null) {
			buf.append(" sequence=\"").append(sequence).append("\"");
		}
		if (unique != null) {
			buf.append(" unique=\"").append(unique).append("\"");
		}
		if (format != null) {
			buf.append(" format=\"").append(format).append("\"");
		}
		buf.append(">").append(title).append("</id>");
		return buf.toString();
	}
}
